package com.lagou.edu.controller;

import com.lagou.edu.pojo.Resume;
import com.lagou.edu.service.ResumeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by shixi  on 2020/10/8
 */
@Controller
@RequestMapping("/resume")
public class ResumeController {

    @Autowired
    ResumeServiceImpl resumeService;

    @RequestMapping("/getAll")
    @ResponseBody
    public List<Resume> getAll(){
        return resumeService.findAll();
    }

    @RequestMapping("/save")
    @ResponseBody
    public Resume save(@RequestBody Resume resume){
        return resumeService.save(resume);
    }


    @RequestMapping("/delete")
    @ResponseBody
    public Integer delete(@RequestBody Resume resume){
        resumeService.delete(resume.getId());
        return 1;
    }

}
